<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <style>
        .el-table .warning-row {
            background: oldlace;
        }

        .el-table .success-row {
            background: #f0f9eb;
        }
    </style>
</head>
<body>


<div id="app">

<!--    搜索表单-->
    <el-form :inline="true" :model="formInline" class="demo-form-inline">
        <el-form-item label="用户姓名">
            <el-input v-model="formInline.user" placeholder="用户姓名"></el-input>
        </el-form-item>
<!--        <el-form-item label="活动区域">-->
<!--            <el-select v-model="formInline.region" placeholder="活动区域">-->
<!--                <el-option label="区域一" value="shanghai"></el-option>-->
<!--                <el-option label="区域二" value="beijing"></el-option>-->
<!--            </el-select>-->
<!--        </el-form-item>-->
        <el-form-item>
            <el-button type="primary" @click="onSubmit">查询</el-button>
        </el-form-item>
    </el-form>


<!--    表格-->
    <template>
        <el-table
                :data="statis"
                style="width: 100%"
                :row-class-name="tableRowClassName">
            <el-table-column
                    prop="type"
                    label="类型"
                    width="180">
            </el-table-column>
            <el-table-column
                    prop="time"
                    label="时间"
                    width="180">
            </el-table-column>
            <el-table-column
                    prop="num"
                    label="数量"
                    width="180">
            </el-table-column>
            <el-table-column
                    prop="incomeAll"
                    label="收入">
            </el-table-column>
<!--            <el-table-column label="操作">-->
<!--                <template slot-scope="scope">-->
<!--                    <el-button-->
<!--                            size="mini"-->
<!--                            @click="handleEdit(scope.$index, scope.row)">挂号</el-button>-->
<!--                </template>-->
<!--            </el-table-column>-->
        </el-table>
    </template>

</div>

<script src="../js/vue.js"></script>
<script src="../element-ui/lib/index.js"></script>
<link rel="stylesheet" href="../element-ui/lib/theme-chalk/index.css">
<script src="../js/axios-0.18.0.js"></script>

<script>
    new Vue({
        el:"#app",
        mounted(){
            this.selectAllStatis();
        },
        data() {
            return {
                dialogLoginVisible: false,
                admin: {
                    accountNum: "",
                    pwd:""
                },
                formLabelWidth: '120px',
                formInline: {
                    user: '',
                    region: ''
                },
                statis: []
            }
        },
        methods: {

            selectAllStatis(){
                axios.get("http://localhost:8080/statis/selectAll").then(resp=>{
                    this.statis = resp.data;
                })
            },

            adminLogin() {
                console.log(this.admin);
                axios.post("http://localhost:8080/admin/login",this.admin).then(resp=>{
                    if(resp.data.msg === "success"){
                        this.$message.success("登录成功");
                        this.admin = resp.data.data;
                        this.dialogLoginVisible = false;
                    }else{
                        this.$message.error("登录失败");
                    }
                })
            },

            onSubmit() {
                console.log('submit!');
            },
            tableRowClassName({row, rowIndex}) {
                if (rowIndex === 1) {
                    return 'warning-row';
                } else if (rowIndex === 3) {
                    return 'success-row';
                }
                return '';
            },

            handleEdit(index, row) {
                console.log(index, row);
            },
            handleDelete(index, row) {
                console.log(index, row);
            }
        },
    })
</script>

</body>
</html>